import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {SapOrderForm, SapOrderQuery, SapOrderVO} from '@/api/painting/sapOrder/types';

/**
 * 查询SAP订单管理列表
 * @param query
 * @returns {*}
 */

export const listSapOrder = (query?: SapOrderQuery): AxiosPromise<SapOrderVO[]> => {
  return request({
    url: '/painting/sapOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询SAP订单管理详细
 * @param id
 */
export const getSapOrder = (id: string | number): AxiosPromise<SapOrderVO> => {
  return request({
    url: '/painting/sapOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增SAP订单管理
 * @param data
 */
export const addSapOrder = (data: SapOrderForm) => {
  return request({
    url: '/painting/sapOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改SAP订单管理
 * @param data
 */
export const updateSapOrder = (data: SapOrderForm) => {
  return request({
    url: '/painting/sapOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除SAP订单管理
 * @param id
 */
export const delSapOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/painting/sapOrder/' + id,
    method: 'delete'
  });
};
